package org.hhy.cloud.crawl.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;

/**
 * 爬虫模块kafka consumer 配置属性类
 * @author LiuHao
 * @date 2020/11/13 0:45
 * @description
*/

@Data
@ConfigurationProperties(prefix = "cloud.crawl.kafka")
public class CrawlKafkaProperties {

    private List<String> bootstrapServers;
    private final CrawlKafkaProperties.Consumer consumer = new CrawlKafkaProperties.Consumer();
    private final CrawlKafkaProperties.Producer producer = new CrawlKafkaProperties.Producer();

    @Data
    public static class Producer{
        private String acks;
        private Integer retries;
        private Integer batchSize;
        private Integer lingerMs;
        private Integer bufferMemory;
    }

    @Data
    public static class Consumer{
        private String maxPollRecords;
        private String dbGroupId;
        private String esGroupId;
        private String autoOffsetReset;
        private String autoCommitIntervalMs;
        private String sessionTimeoutMs;
    }

    public List<String> getBootstrapServers() {
        return bootstrapServers;
    }

    public void setBootstrapServers(List<String> bootstrapServers) {
        this.bootstrapServers = bootstrapServers;
    }

    public Consumer getConsumer() {
        return consumer;
    }

    public Producer getProducer() {
        return producer;
    }
}
